<html>
<head><meta charset="utf-8"><title>Documentation for Alloc Ref · t-libs/wg-allocators · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/index.html">t-libs/wg-allocators</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Documentation.20for.20Alloc.20Ref.html">Documentation for Alloc Ref</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205682230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Documentation%20for%20Alloc%20Ref/near/205682230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> HeroicKatora <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Documentation.20for.20Alloc.20Ref.html#205682230">(Aug 01 2020 at 13:48)</a>:</h4>
<p>The documentation currently says:</p>
<blockquote>
<p>Memory blocks returned from an allocator must point to valid memory and retain their validity until the instance and all of its clones are dropped,</p>
</blockquote>
<p>This is <a href="https://github.com/rust-lang/rust/search?q=%22valid+memory%22&amp;unscoped_q=%22valid+memory%22">the only mention</a> of the term 'valid memory' in the documentation, otherwise only used internally in MIR. It does in particular not mention that the owner of the caller is free to read and write any data, including uninitialized bytes, into said memory block.</p>



<a name="205687474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Documentation%20for%20Alloc%20Ref/near/205687474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Documentation.20for.20Alloc.20Ref.html#205687474">(Aug 01 2020 at 16:11)</a>:</h4>
<p>I'm pretty sure the wording is just a coincidence rather than specifically referring to MIR semantics.</p>



<a name="205691612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Documentation%20for%20Alloc%20Ref/near/205691612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Documentation.20for.20Alloc.20Ref.html#205691612">(Aug 01 2020 at 17:55)</a>:</h4>
<p>I think the intent was more likely to be that the memory block returned must be exclusive to that block, with no one else also accessing it.</p>



<a name="205694465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Documentation%20for%20Alloc%20Ref/near/205694465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> HeroicKatora <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Documentation.20for.20Alloc.20Ref.html#205694465">(Aug 01 2020 at 19:14)</a>:</h4>
<p>I don't think it is pure coincidence. The (llvm level) semantics of references also require them to stretch the same underlying allocation, which I think is part of what the miri comment refers to. So these are connected. In any case the doc should be reworded, it's the unsafely required semantic for allocator implementors. Where should the issue live, rust or wg-allocator?</p>



<a name="205695555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Documentation%20for%20Alloc%20Ref/near/205695555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tim Diekmann <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Documentation.20for.20Alloc.20Ref.html#205695555">(Aug 01 2020 at 19:46)</a>:</h4>
<p>As we already have <a href="https://github.com/rust-lang/wg-allocators/issues/46">#46</a> I think wg-allocators is the right place.</p>



<a name="205696046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Documentation%20for%20Alloc%20Ref/near/205696046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> HeroicKatora <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Documentation.20for.20Alloc.20Ref.html#205696046">(Aug 01 2020 at 20:01)</a>:</h4>
<p>Opened <a href="https://github.com/rust-lang/wg-allocators/issues/65">https://github.com/rust-lang/wg-allocators/issues/65</a> for it.</p>



<a name="205700698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/Documentation%20for%20Alloc%20Ref/near/205700698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tim Diekmann <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/Documentation.20for.20Alloc.20Ref.html#205700698">(Aug 01 2020 at 22:24)</a>:</h4>
<p>Thank you!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>